package com.angel.crowd.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author yuzhen
 * @create 2020-05-12 21:14
 */
@Configuration
public class CrowdWebMvcConfig implements WebMvcConfigurer{

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // 浏览器访问的地址
        String urlPathAgree = "/agree/protocol/page";
        String urlPathLaunch = "/launch/project/page";
        String urlPathReturn = "/return/info/page";
        String urlPathConfirm = "/create/confirm/page";
        String urlPathSuccess = "/create/success";
        String urlPathDetail = "/show/detail";

        // 目标视图的名称，将来拼接“prefix: classpath:/templates/”、“suffix: .html”前后缀
        String viewNameAgree = "project-agree";
        String viewNameLaunch = "project-launch";
        String viewNameReturn = "project-return";
        String viewNameConfirm = "project-confirm";
        String viewNameSuccess = "project-success";
        String viewNameDetail=  "project-detail";


        // view-controller是在project-consumer内部定义的，所以这里是一个不经过Zuul访问的地址，所以这个路径前面不加路由规则中定义的前缀：“/project”
        registry.addViewController(urlPathAgree).setViewName(viewNameAgree);
        registry.addViewController(urlPathLaunch).setViewName(viewNameLaunch);
        registry.addViewController(urlPathReturn).setViewName(viewNameReturn);
        registry.addViewController(urlPathConfirm).setViewName(viewNameConfirm);
        registry.addViewController(urlPathSuccess).setViewName(viewNameSuccess);
        registry.addViewController(urlPathDetail).setViewName(viewNameDetail);


    }


}
